/* 
 * File:   Factory.h
 * Author: Bram
 *
 * Created on January 21, 2013, 6:30 PM
 */

#ifndef FACTORY_H
#define	FACTORY_H


#include <map>
#include <string>
#include "Command.h"
#include "ErrorCommand.h"

using namespace std;

class Factory {
private:
    static void assign(const char*, Command*);
    static Command* create(string component);
    static Command* extractCommand(string& input);
    static Command* extractCommandFromUserInput(string& input);
    static Command* extractCommandFromXml(string& xml);
public:
    Factory();
    Factory(const Factory& orig);
    virtual ~Factory();
    static Command* createFromInput(string& input);
    static Command* createFromUserInput(string& input);
    static Command* createFromXml(string& xml);
    static bool exists(string component);

private:
    typedef map<string, Command*> CommandMap;

private:
    static CommandMap &getMap();

    friend class Command;
private:

};

#endif	/* FACTORY_H */

